<%--
  Created by IntelliJ IDEA.
  User: why
  Date: 2021/1/25
  Time: 18:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>login</title>
</head>
<body>
<%--获取服务器端返回的--%>
<%
    //声明变量接收服务器数据
    String name = "";
    String password = "";
    String ck="";
    Cookie[] cookies = request.getCookies();
    if (cookies != null) {
        for (Cookie cookie : cookies) {
            if ("username".equals(cookie.getName())) { //比较本地客户端缓存的数据和服务器传来的
                name = cookie.getValue();
                ck="ck";
            }
            if ("pwd".equals(cookie.getName())) {
                password = cookie.getValue();
            }
        }
    }
%>


<form action="/cookie/test" method="get" autocomplete="off">
    姓名<input type="text" name="username" value="<%=name%>" required><br>
    密码<input type="text" name="password" value="<%=password%>" required><br>
    <input type="checkbox" name="ck"<%=ck%> >记住此账号
    <button type="submit">登录</button>
</form>


</body>
</html>
